import React, { useState,useEffect,createContext } from 'react'

import { Row, Col,Breadcrumb } from 'antd';
import { HomeOutlined } from '@ant-design/icons';
import './home.less'

import BusCard from '../../components/business_card/business_card'
import Advertise from '../../components/advertise/advertise'
import Homelist from '../../components/homelist/homelist'

import {reqGetPsgBrief} from '../../api/index'

export const HomeContext = createContext()
export const Home = () => {
    const [passagesbrief, setpassagesbrief] = useState([]);
   
    useEffect(() => {
       const getList =async ()=>{
           let result = await reqGetPsgBrief()
           setpassagesbrief(result.data)
           //console.log("relutef ef e fe ",result.data)
       }
       getList()
    }, []);
  
    return (
        <Row>
            <Col xs={{ span: 22, offset: 1 }} lg={{ span: 14, offset: 2 }} className='col'>
            <Breadcrumb>
            <Breadcrumb.Item >
              <HomeOutlined  style={{fontSize:'1.2rem',marginTop:'.8rem',marginLeft:'.8rem'}}/>
            </Breadcrumb.Item>
           </Breadcrumb>
           <HomeContext.Provider value={passagesbrief}>
                <Homelist />
           </HomeContext.Provider>
          

            </Col>
            <Col xs={{ span: 0 }} lg={{ span: 5, offset: 1 }} className='col col2'>
            {
                //个人信息页和广告位
            }
            <BusCard/>
            <Advertise/>
            </Col>
        </Row>
    )
}

